<?php

namespace app\api\controller;

use app\api\service\IndexService;
use app\api\service\LoginService;
use app\BaseController;
use think\facade\Request;

class Index extends BaseController
{
    public function bannerList(){
        $type = Request::post("type",5);
        $page = Request::post("page",1);
        $num = Request::post("num",6);

        $data = IndexService::wxIndex($type,$page,$num);
        return $data;
    }


    public function userCode(){
        if(Request::isPost()) {
            $user_id = LoginService::getUserIdFromToken();
            if (!is_numeric($user_id)) {
                return $user_id;
            }
            $url = Request::param("url");
            $type = Request::param("type");
            $data = IndexService::makeWxCode($url,$type);
            return $data;
        }
    }

}